package cn.tedu.csmall.product.webapi.controller;

import cn.tedu.csmall.commons.response.JsonResult;
import cn.tedu.csmall.pojo.dto.AttributeAddNewDTO;
import cn.tedu.csmall.product.service.IAttributeService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/attributes")
@Api(tags = "6.属性管理模块")
public class AttributeController {

    @Autowired
    private IAttributeService attributeService;

    @PostMapping("/add-new")
    @ApiOperation(value = "增加属性")
    @ApiOperationSupport(order = 10)
    public JsonResult<Void> addNew(@Valid AttributeAddNewDTO attributeAddNewDTO){
        attributeService.addNew(attributeAddNewDTO);
        return JsonResult.ok();
    }
}
